#include <bits/stdc++.h>
using namespace std;
#define int long long
int n,sum;
vector<int> v;
bool check(int x)
{
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        int y=x/v[i]+1;
        cnt+=y;
    }
    return cnt<=x;
}
void solve()
{
    cin>>n;
    sum=0;
    v=vector<int>(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>v[i];
        sum+=v[i];
    }
    int l=1,r=100000000,mid;
    while(l<r)
    {
        mid=(r-l)/2+l+1;
        if(check(mid))r=mid;
        l=mid+1;
    }
    if(r==100000000)
    {
        cout<<-1<<endl;
        return;
    }
    int tmp=0;
    for(int i=1;i<=n;i++)
    {
        int y=l/v[i];
        while(y*v[i]<=l)y++;
        cout<<y<<" ";
    }
    cout<<endl;
}
signed main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int T=1;
    cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}